package com.web.servlet;


import java.util.HashMap;
import java.util.Map;

/**
 * Created by Alige on 2016/6/1.
 */
public class MessageBox {


    private final Long  statusCode;
    private final String  nextUrl;
    private final Map<String ,Object> param;
    private  final String  message;
    private  final String  nowUrl;

    public Long getStatusCode() {
        return statusCode;
    }

    public String getNextUrl() {
        return nextUrl;
    }

    public Map<String, Object> getParam() {
        return param;
    }

    public String getMessage() {
        return message;
    }

    public String getNowUrl() {
        return nowUrl;
    }

    public MessageBox(Builder builder){
        this.message=builder.message;
        this.nowUrl=builder.nowUrl;
        this.param=builder.param;
        this.nextUrl=builder.nextUrl;
        this.statusCode =builder.statusCode;
    }


     public static  class  Builder{
         private   Long  statusCode;
         private   String  nextUrl;
         private   Map<String ,Object> param;
         private    String  message;
         private    String  nowUrl;

         public  Builder( Long statusCode){
             this.statusCode=statusCode;
             param =new HashMap<>();
         }

         public Builder nextUrl(String nextUrl){
              this.nextUrl=nextUrl;
              return this;
         }
         public Builder message(String message){
             this.message=message;
             return this;
         }
         public Builder nowUrl(String nowUrl){
             this.nowUrl=nowUrl;
             return this;
         }
         public Builder param(String nowUrl,Object object){
             this.param.put(nowUrl,object);
             return this;
         }

         public  MessageBox build(){
               return  new MessageBox(this);
         }





     }

}
